package com.thinkgem.redis;
import redis.clients.jedis.Jedis;

/**
 * Hello world!
 *  https://help.aliyun.com/document_detail/26367.html?spm=5176.doc26366.6.582.tjXO0z
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        
        Jedis jedis = new Jedis("localhost",6379);
        //jedis.connect();
        jedis.set("foo", "bar");
        System.out.println(jedis.isConnected());
//    	String value = jedis.get("foo");
//        System.out.println(value);
        //jedis.disconnect();
       //jedis.close();
       //jedis.shutdown();
        
        jedis.quit();

        try{
            System.out.println(jedis.get("foo"));
        }catch(Exception ex){
        	ex.printStackTrace();
        }
        System.out.println(jedis.ping());
        for(int i=0;i<1000;i++){
        	try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
            System.out.println(jedis.isConnected());
        }
    }
}
